//
//  ViewController.m
//  10509Caculation计算面积
//
//  Created by student on 16/2/20.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField1;
@property (weak, nonatomic) IBOutlet UITextField *textField2;
@property (weak, nonatomic) IBOutlet UITextField *textField3;
@property (weak, nonatomic) IBOutlet UITextField *textField4;
@property (weak, nonatomic) IBOutlet UITextField *textField5;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)btnPressed:(id)sender {
    if ([self.textField1.text isEqualToString:@""]&&[self.textField2.text isEqualToString:@""]) {
        self.textField3.text=@"";
    }
    else{
       self.textField3.text=[NSString stringWithFormat:@"%i",[self.textField1.text intValue]*[self.textField2.text intValue]];
    }
    if ([self.textField4.text isEqualToString:@""]){
        self.textField5.text=@"";
    }
    else{
        self.textField5.text=[NSString stringWithFormat:@"%f",[self.textField4.text intValue]*[self.textField4.text intValue]*3.14];
    }
}
- (IBAction)backTap:(id)sender {
    [self.view endEditing:YES];
}

- (IBAction)clearPressed:(id)sender {
    self.textField1.text=@"0";
    self.textField2.text=@"0";
    self.textField3.text=@"0";
    self.textField4.text=@"0";
    self.textField5.text=@"0";
}
- (IBAction)reset:(id)sender {
    self.textField1.text=@"";
    self.textField2.text=@"";
    self.textField3.text=@"";
    self.textField4.text=@"";
    self.textField5.text=@"";
}
@end
